package org.jsola.hr.helper;

import org.jsola.hr.constant.EmpInfoRequireType;
import org.jsola.hr.constant.EmpInfoScene;
import org.jsola.hr.dto.CompanyEmpInfoRequireAddDTO;
import org.jsola.hr.dto.CompanyEmpInfoRequireUpdateDTO;
import org.jsola.hr.entity.CompanyEmpInfoRequireDO;
import org.jsola.hr.query.CompanyEmpInfoRequireQuery;
import org.jsola.hr.service.ICompanyEmpInfoRequireService;
import org.jsola.hr.vo.CompanyEmpInfoRequireVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.util.CollectionUtils;

import java.util.List;

import static org.jsola.hr.core.AbstractTest.SITE_ID;



/**
 * @author zhr
 */
@Component
public class CompanyEmpInfoRequireTestHelper extends BaseTestHelper {
    
    @Autowired
    private CompanyTestHelper companyTestHelper;
    @Autowired
    private ICompanyEmpInfoRequireService companyEmpInfoRequireService;

    /**
     * 生成add测试数据
     * @return CompanyEmpInfoRequireAddDTO
     */
    public CompanyEmpInfoRequireAddDTO getCompanyEmpInfoRequireAddDTO(){
        CompanyEmpInfoRequireAddDTO companyEmpInfoRequireAddDTO = new CompanyEmpInfoRequireAddDTO();
        companyEmpInfoRequireAddDTO.setCompanyId(companyTestHelper.saveCompanyExample().getId());
        companyEmpInfoRequireAddDTO.setType(EmpInfoScene.ENTRY.getValue());
        companyEmpInfoRequireAddDTO.setNumber(EmpInfoRequireType.NO_NEED.getValue());
        companyEmpInfoRequireAddDTO.setName(EmpInfoRequireType.NO_NEED.getValue());
        companyEmpInfoRequireAddDTO.setIdCard(EmpInfoRequireType.NO_NEED.getValue());
        companyEmpInfoRequireAddDTO.setNation(EmpInfoRequireType.NO_NEED.getValue());
        companyEmpInfoRequireAddDTO.setBirthday(EmpInfoRequireType.NO_NEED.getValue());
        companyEmpInfoRequireAddDTO.setGender(EmpInfoRequireType.NO_NEED.getValue());
        companyEmpInfoRequireAddDTO.setPhone(EmpInfoRequireType.NO_NEED.getValue());
        companyEmpInfoRequireAddDTO.setEmail(EmpInfoRequireType.NO_NEED.getValue());
        companyEmpInfoRequireAddDTO.setEmpPhoto(EmpInfoRequireType.NO_NEED.getValue());
        companyEmpInfoRequireAddDTO.setHighestEducation(EmpInfoRequireType.NO_NEED.getValue());
        companyEmpInfoRequireAddDTO.setMaritalStatus(EmpInfoRequireType.NO_NEED.getValue());
        companyEmpInfoRequireAddDTO.setBirthStatus(EmpInfoRequireType.NO_NEED.getValue());
        companyEmpInfoRequireAddDTO.setPoliticalStatus(EmpInfoRequireType.NO_NEED.getValue());
        companyEmpInfoRequireAddDTO.setPartyDate(EmpInfoRequireType.NO_NEED.getValue());
        companyEmpInfoRequireAddDTO.setPartySite(EmpInfoRequireType.NO_NEED.getValue());
        companyEmpInfoRequireAddDTO.setBirthplace(EmpInfoRequireType.NO_NEED.getValue());
        companyEmpInfoRequireAddDTO.setNativeLocation(EmpInfoRequireType.NO_NEED.getValue());
        companyEmpInfoRequireAddDTO.setRegType(EmpInfoRequireType.NO_NEED.getValue());
        companyEmpInfoRequireAddDTO.setCurrentLocation(EmpInfoRequireType.NO_NEED.getValue());
        companyEmpInfoRequireAddDTO.setEmerContact(EmpInfoRequireType.NO_NEED.getValue());
        companyEmpInfoRequireAddDTO.setEmerPhone(EmpInfoRequireType.NO_NEED.getValue());
        companyEmpInfoRequireAddDTO.setEmerLocation(EmpInfoRequireType.NO_NEED.getValue());
        companyEmpInfoRequireAddDTO.setBankCard(EmpInfoRequireType.NO_NEED.getValue());
        companyEmpInfoRequireAddDTO.setBankName(EmpInfoRequireType.NO_NEED.getValue());
        companyEmpInfoRequireAddDTO.setBankPlace(EmpInfoRequireType.NO_NEED.getValue());
        companyEmpInfoRequireAddDTO.setSocType(EmpInfoRequireType.NO_NEED.getValue());
        companyEmpInfoRequireAddDTO.setSocCard(EmpInfoRequireType.NO_NEED.getValue());
        companyEmpInfoRequireAddDTO.setHealthCondition(EmpInfoRequireType.NO_NEED.getValue());
        companyEmpInfoRequireAddDTO.setHasWeightyMedicalHis(EmpInfoRequireType.NO_NEED.getValue());
        companyEmpInfoRequireAddDTO.setJobTitle(EmpInfoRequireType.NO_NEED.getValue());
        companyEmpInfoRequireAddDTO.setJoinWorkDate(EmpInfoRequireType.NO_NEED.getValue());
        companyEmpInfoRequireAddDTO.setWorkingUnitName(EmpInfoRequireType.NO_NEED.getValue());
        companyEmpInfoRequireAddDTO.setPutonghuaLevel(EmpInfoRequireType.NO_NEED.getValue());
        companyEmpInfoRequireAddDTO.setSpeciality(EmpInfoRequireType.NO_NEED.getValue());
        companyEmpInfoRequireAddDTO.setPrizeWinning(EmpInfoRequireType.NO_NEED.getValue());
        companyEmpInfoRequireAddDTO.setEnglishLevel(EmpInfoRequireType.NO_NEED.getValue());
        companyEmpInfoRequireAddDTO.setNcreLevel(EmpInfoRequireType.NO_NEED.getValue());
        companyEmpInfoRequireAddDTO.setTargetPost(EmpInfoRequireType.NO_NEED.getValue());
        companyEmpInfoRequireAddDTO.setTabContacts(EmpInfoRequireType.NO_NEED.getValue());
        companyEmpInfoRequireAddDTO.setTabWork(EmpInfoRequireType.NO_NEED.getValue());
        companyEmpInfoRequireAddDTO.setTabEducation(EmpInfoRequireType.NO_NEED.getValue());
        companyEmpInfoRequireAddDTO.setTabCard(EmpInfoRequireType.NO_NEED.getValue());
        companyEmpInfoRequireAddDTO.setTabTrain(EmpInfoRequireType.NO_NEED.getValue());
        companyEmpInfoRequireAddDTO.setTabCertificate(EmpInfoRequireType.NO_NEED.getValue());
        companyEmpInfoRequireAddDTO.setAnnexIdCard(EmpInfoRequireType.NO_NEED.getValue());
        companyEmpInfoRequireAddDTO.setAnnexHousehold(EmpInfoRequireType.NO_NEED.getValue());
        companyEmpInfoRequireAddDTO.setAnnexDiploma(EmpInfoRequireType.NO_NEED.getValue());
        companyEmpInfoRequireAddDTO.setAnnexDegree(EmpInfoRequireType.NO_NEED.getValue());
        companyEmpInfoRequireAddDTO.setAnnexPractising(EmpInfoRequireType.NO_NEED.getValue());
        companyEmpInfoRequireAddDTO.setAnnexMajor(EmpInfoRequireType.NO_NEED.getValue());
        companyEmpInfoRequireAddDTO.setAnnexReward(EmpInfoRequireType.NO_NEED.getValue());
        companyEmpInfoRequireAddDTO.setAnnexNoCriminal(EmpInfoRequireType.NO_NEED.getValue());
        companyEmpInfoRequireAddDTO.setAnnexBlackWhitePhoto(EmpInfoRequireType.NO_NEED.getValue());
        companyEmpInfoRequireAddDTO.setAnnexPthLevel(EmpInfoRequireType.NO_NEED.getValue());
        companyEmpInfoRequireAddDTO.setAnnexEnglishLevel(EmpInfoRequireType.NO_NEED.getValue());
        companyEmpInfoRequireAddDTO.setAnnexNcreLevel(EmpInfoRequireType.NO_NEED.getValue());
        companyEmpInfoRequireAddDTO.setAnnexDrivingLicense(EmpInfoRequireType.NO_NEED.getValue());
        return companyEmpInfoRequireAddDTO;
    }


    /**
     * 生成update测试数据
     * @return CompanyEmpInfoRequireUpdateDTO
     */
    public CompanyEmpInfoRequireUpdateDTO getCompanyEmpInfoRequireUpdateDTO(CompanyEmpInfoRequireVO companyEmpInfoRequireVO){
        return companyEmpInfoRequireService.selectDOById(companyEmpInfoRequireVO.getId(), SITE_ID).to(CompanyEmpInfoRequireUpdateDTO.class);
    }

    /**
     * 生成查询数据
     * @return CompanyEmpInfoRequireQuery
     */
    public CompanyEmpInfoRequireQuery getCompanyEmpInfoRequireQuery() {
        CompanyEmpInfoRequireQuery companyEmpInfoRequireQuery = new CompanyEmpInfoRequireQuery();
        List<CompanyEmpInfoRequireDO> companyEmpInfoRequireDOList = companyEmpInfoRequireService.list(new CompanyEmpInfoRequireDO(),SITE_ID);
        if (!CollectionUtils.isEmpty(companyEmpInfoRequireDOList)) {
            CompanyEmpInfoRequireDO companyEmpInfoRequireDO = companyEmpInfoRequireDOList.get(0);
            companyEmpInfoRequireQuery = companyEmpInfoRequireDO.to(CompanyEmpInfoRequireQuery.class);
        }
        return companyEmpInfoRequireQuery;
    }

    /**
     * 保存示例
     * @return CompanyEmpInfoRequireVO
     */
    public CompanyEmpInfoRequireVO saveCompanyEmpInfoRequireExample(){
        CompanyEmpInfoRequireAddDTO addDTO = this.getCompanyEmpInfoRequireAddDTO();
        CompanyEmpInfoRequireVO companyEmpInfoRequireVO = companyEmpInfoRequireService.save(addDTO,buildTokenUser());
        return companyEmpInfoRequireVO;
    }


}

